<?php

namespace App\Http\Controllers\Common;

use App\Http\Controllers\BaseController;
use App\Service\Common\EkbService;
use App\Service\OpenShop\OrderService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;


class EkbController extends BaseController
{
    /**
     * 支行信息
     *
     * @param Request $request
     * @return JsonResponse
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     * @throws ValidationException
     */
    public function branchBank(Request $request): JsonResponse
    {
//        try{
//            OrderService::refundDecorationDeposit('KD2022103160212075');
//        }catch (\Exception $exception){
//            logException("装修保证金发起退款失败", $exception, ["orderNo" => "KD2022103160212075"], true, true);
//        }
//        die;
//        var_dump(event(new AutoRefundDecorationDepositEvent("KD2022103160212075")));die;

//        $params = (object)["orderNo" => "KD2022103160212075"];
//        $shopId = 20451;
//        $templateId       = CruiseTemplateService::getTemplateId(CruiseOrderModel::TYPE_NEW_SHOP_HELP);
//        CruiseOrderProcessModel::initCruiseOrderProcess($cruiseOrderModel->id);
//        (new CruiseOrderInputService($cruiseOrderModel))->initOrderInput($templateId);
//        die;
        $branchBankName = $request->get("branchBankName", "");
        $bankName       = $request->get("bankName", "");
//        EkbValidate::branchBankValidate(["branchBankName" => $branchBankName]);
        return $this->success(EkbService::branchBank($branchBankName, $bankName));
    }
}
